package com.example.behaviorpattern.state;

import com.example.behaviorpattern.state.impl.StoppedState;
import lombok.Setter;

/**
 * MusicPlayer 上下文对象
 * @author yaojianfeng
 */
@Setter
public class MusicPlayer {
    private PlayerState state;


    public MusicPlayer() {
        // 设置初始状态为停止
        this.state = new StoppedState();
    }

    public void play() {
        state.play(this);
    }

    public void stop() {
        state.stop(this);
    }

    public void pause() {
        state.pause(this);
    }
}